package abcy.cloud.configserver.controller;

import abcy.cloud.configserver.http.ConfigAddReq;
import abcy.cloud.configserver.http.ConfigAddResp;
import abcy.cloud.configserver.services.ConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping(value = "/config")
public class ConfigController {

    @Autowired
    private ConfigService configService;

    @PostMapping(value = "/addConfig")
    public ResponseEntity addConfig(@RequestBody ConfigAddReq configAddReq) {
        configService.addConfig(configAddReq);
        return ResponseEntity.ok("新增成功！");
    }

    @PostMapping(value = "/test")
    public Map<String, Object> test() {
        return new HashMap<>();
    }
}
